home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
windows
/
wdj1096.zip
/
TOMLINSN.ZIP
/
FIGURE1.C
next >
Wrap
Text File
|
1996-07-17
|
915b
|
49 lines
// figure 1
while( TRUE )
{
// check if we have NT, Win95 has no Services
dwVersion = GetVersion();
if( dwVersion >= 0x80000000 )
{
break ;
}
// Try to find the service inside SCManager
schSCManager = OpenSCManager(
NULL,
NULL,
SC_MANAGER_ALL_ACCESS
);
if( schSCManager == NULL )
{
break ;
}
// Try to open the Service
schService = OpenService( schSCManager,
SERVICE_SHORT_NAME,
SERVICE_ALL_ACCESS);
if( schService == NULL )
{
break ;
}
// Try to Alloc a Console (Call fails if we have a Console)
if( NOT AllocConsole() )
break ;
}
// Free Console
FreeConsole() ;
// We are a service
lRet = TRUE ;
break ;
}